package com.px.business.service.impl;

import com.px.business.domain.ApplicationStatus;
import com.px.business.domain.EvaluationModification;
import com.px.business.mapper.EvaluationApplicationMapper;
import com.px.business.mapper.EvaluationModificationMapper;
import com.px.business.service.IEvaluationModificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 品讯科技
 */
@Service
public class EvaluationModificationServiceImpl implements IEvaluationModificationService {
    @Autowired
    private EvaluationModificationMapper evaluationModificationMapper;

    @Autowired
    private EvaluationApplicationMapper evaluationApplicationMapper;

    /**
     * 查询【申请驳回】
     *
     * @param evaluationModificationId 【申请驳回】主键
     * @return 【申请驳回】
     */
    @Override
    public EvaluationModification selectEvaluationModificationByEvaluationModificationId(Long evaluationModificationId) {
        return evaluationModificationMapper.selectEvaluationModificationByEvaluationModificationId(evaluationModificationId);
    }

    /**
     * 查询【申请驳回】列表
     *
     * @param evaluationModification 【申请驳回】
     * @return 【申请驳回】
     */
    @Override
    public List<EvaluationModification> selectEvaluationModificationList(EvaluationModification evaluationModification) {
        return evaluationModificationMapper.selectEvaluationModificationList(evaluationModification);
    }

    /**
     * 新增【申请驳回】
     *
     * @param evaluationModification 【申请驳回】
     * @return 结果
     */
    @Override
    public int insertEvaluationModification(EvaluationModification evaluationModification) {
        evaluationModificationMapper.insertEvaluationModification(evaluationModification);
        ApplicationStatus applicationStatus = new ApplicationStatus();
        applicationStatus.setEvaluationApplicationId(evaluationModification.getEvaluationApplicationId());
        applicationStatus.setAppliedStatus(10);
        evaluationApplicationMapper.changeState(applicationStatus);
        return 1;
    }

    /**
     * 修改【申请驳回】
     *
     * @param evaluationModification 【申请驳回】
     * @return 结果
     */
    @Override
    public int updateEvaluationModification(EvaluationModification evaluationModification) {
        return evaluationModificationMapper.updateEvaluationModification(evaluationModification);
    }

    /**
     * 批量删除【申请驳回】
     *
     * @param evaluationModificationIds 需要删除的【申请驳回】主键
     * @return 结果
     */
    @Override
    public int deleteEvaluationModificationByEvaluationModificationIds(Long[] evaluationModificationIds) {
        return evaluationModificationMapper.deleteEvaluationModificationByEvaluationModificationIds(evaluationModificationIds);
    }

    /**
     * 删除【申请驳回】信息
     *
     * @param evaluationModificationId 【申请驳回】主键
     * @return 结果
     */
    @Override
    public int deleteEvaluationModificationByEvaluationModificationId(Long evaluationModificationId) {
        return evaluationModificationMapper.deleteEvaluationModificationByEvaluationModificationId(evaluationModificationId);
    }
}
